<?php
define('KC_INDEX',True);

require_once '../global.php';

function king_def(){
	global $king;
	
	$king->load('user');//加载用户判断	
	$king->load('portal');//
	$user=$king->user->checkLogin();//判断用户是否登录
		$a='<div class="lef_home"><span class="zx"><a href="/">首页</a></span><span class="jl"><a href="/browse/list/3/1/">资讯</a></span><span class="jl"><a href="/browse/home/">知道</a></span><span class="jl"><a href="/browse/list/4/1/">专题</a></span><span class="zt"><a href="/page/1">商家</a></span></div>
';
		$s='<div id="login"><span><input type="button" value="登陆" onclick="$.kc_ajax({URL:\''.$king->config('inst').'user/index.php\',CMD:\'login\',METHOD:\'GET\',kuidb:\''.$kid.'\',typeid:\''.$typeid.'\'});return false"/></span>';
	
		$s.='<span><input type="button" value="注册" onclick="$.kc_ajax({URL:\''.$king->config('inst').'user/index.php\',CMD:\'register\',METHOD:\'GET\',kuidb:\''.$kid.'\',typeid:\''.$typeid.'\'});return false"/></span></div>';
		
		
		if(empty($user)){
			echo $a.$s;
		}else{
			echo $a.'<div id="login"><span>'.$user['username'].' </span><span><a href="/browse/user/">用户中心</a> <input type="button" value="注销" onclick="$.kc_ajax({URL:\''.$king->config('inst').'user/index.php\',CMD:\'logout\',METHOD:\'GET\',kuidb:\''.$kid.'\',typeid:\''.$typeid.'\'});return false"/></span></div>';
		}
		
		
	}
?>